/**
 * Copyright (C) 2011 Domenico Briganti <dometec@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package it.webrules.deploymanager.webapp.exception;

import it.webrules.deploymanager.webapp.utils.LogLevel;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;

public class DeployManagerRestException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private LogLevel logLevel = LogLevel.debug;
	private Status status;
	private int errorcode;
	private MediaType mediaType;

	public DeployManagerRestException() {
		mediaType = MediaType.APPLICATION_XML_TYPE;
	}

	public DeployManagerRestException(String message, Status status, int errorcode) {
		super(message);
		this.status = status;
		this.errorcode = errorcode;
	}

	public DeployManagerRestException(LogLevel logLevel, String message, Status status, int errorcode) {
		this(message, status, errorcode);
		this.logLevel = logLevel;
	}

	public DeployManagerRestException(LogLevel logLevel, String message, Status status, int errorcode, Throwable cause) {
		super(message, cause);
		this.status = status;
		this.errorcode = errorcode;
		this.logLevel = logLevel;
	}

	public DeployManagerRestException(String message, Status status, int errorcode, Throwable cause) {
		super(message, cause);
		this.status = status;
		this.errorcode = errorcode;
	}

	public DeployManagerRestException(String message, int errorcode) {
		super(message);
		this.errorcode = errorcode;
	}

	public DeployManagerRestException(String message, Throwable cause) {
		super(message, cause);
	}

	public DeployManagerRestException(String message) {
		super(message);
	}

	public DeployManagerRestException(Throwable cause) {
		super(cause);
	}

	public Status getStatus() {
		return status;
	}

	public DeployManagerRestException setStatus(Status status) {
		this.status = status;
		return this;
	}

	public int getErrorcode() {
		return errorcode;
	}

	public DeployManagerRestException setErrorcode(int errorcode) {
		this.errorcode = errorcode;
		return this;
	}

	public LogLevel getLogLevel() {
		return logLevel;
	}

	public MediaType getMediaType() {
		return mediaType;
	}

	public DeployManagerRestException setMediaType(MediaType mediaType) {
		this.mediaType = mediaType;
		return this;
	}

	public DeployManagerRestException setLogLevel(LogLevel logLevel) {
		this.logLevel = logLevel;
		return this;
	}

	@Override
	public String toString() {
		return "DeployManagerRestException [logLevel=" + logLevel + ", status=" + status + ", errorcode=" + errorcode + ", mediaType="
				+ mediaType + "]";
	}

}